<?php

class Kd_Html_Form_ValidateCode extends Kd_Html_Form_Element {

    public function  __construct() {
        parent::__construct();
        $this->templateName = 'form/validatecode';
        $this->addClass('input');
    }

    protected function renderReadonly(){}

    protected function renderEditable(){
        
        if(!$this->getEnabled()){
            $this->addClass('disabled');
        }

        $this->setAttribute('id', $this->getId())
             ->setAttribute('name', $this->getName());
        if(!$this->getEnabled()){
            $this->setAttribute('disabled', 'disabled');
        }

        $result = '<input '.$this->getAttributeHtml().'/><br>';
        $result.= '<img onclick="javascript:this.src=this.src+1" src="'.Kd_Web::getRouter()->getBaseUrl().'validatecode.php?" width="130" height="50" style="cursor:pointer" alt="点击刷新"/>';
        return $result;
    }
}